package com.stropheware.droidDefense;

import java.util.ArrayList;

import android.util.Log;

public class AchievementManager {
	public ArrayList<Achievement> achievements;
	
	public static final String TAG = "Achievement Manager";
	
	public static final String A_0 = "Welcome to the Machine"; //title
	public static final String A_0D = "Complete Story Mode"; //description
	
	public static final String A_1 = "Another Brick in the Wall";
	public static final String A_1D = "Destroy 1,000 Enemies";
	
	public static final String A_2 = "The Great Gig in the Sky";
	public static final String A_2D = "Destroy 10,000 Enemies";
	
	public static final String A_3 = "Have a Cigar";
	public static final String A_3D = "Destroy 100,000 Enemies";
	
	public static final String A_4 = "Signs of Life";
	public static final String A_4D = "Complete 50 Rounds";
	
	public static final String A_5 = "Learning to Fly";
	public static final String A_5D = "Complete 500 Rounds";
	
	public static final String A_6 = "Obscured by Clouds";
	public static final String A_6D = "Complete 5000 Rounds";
	
	public static final String A_7 = "Comfortably Numb";
	public static final String A_7D = "Complete Story Mode Without Losing a Life";
	
	public AchievementManager() {
		achievements = new ArrayList<Achievement>();
		achievements.add(new Achievement(0, A_0, A_0D, 1));
		achievements.add(new Achievement(1, A_1, A_1D, 1000));
		achievements.add(new Achievement(2, A_2, A_2D, 10000));
		achievements.add(new Achievement(3, A_3, A_3D, 100000));
		achievements.add(new Achievement(4, A_4, A_4D, 50));
		achievements.add(new Achievement(5, A_5, A_5D, 500));
		achievements.add(new Achievement(6, A_6, A_6D, 5000));
		achievements.add(new Achievement(7, A_7, A_7D, 1));
		loadFromDisk();
	}
	
	private void loadFromDisk() { //TODO
		
	}
	
	private void writeToDisk() { //TODO
		
	}
	
	public void notifyStoryCompleted() {
		if(achievements.get(0).increaseCompleted()) Log.d(TAG, "achievement unlocked");
	}
	
	public void notifyEnemyDestroy() {
		if(achievements.get(1).increaseCompleted()) Log.d(TAG, "achievement unlocked");
		if(achievements.get(2).increaseCompleted()) Log.d(TAG, "achievement unlocked");
		if(achievements.get(3).increaseCompleted()) Log.d(TAG, "achievement unlocked");
	}
	
	public void notifyRoundCompleted() {
		if(achievements.get(4).increaseCompleted()) Log.d(TAG, "achievement unlocked");
		if(achievements.get(5).increaseCompleted()) Log.d(TAG, "achievement unlocked");
		if(achievements.get(6).increaseCompleted()) Log.d(TAG, "achievement unlocked");
	}
}
